<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>学生主页</title>
	<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
	<link rel="stylesheet" href="__PUBLIC__/student/css/common.css">
	<link href="__PUBLIC__/student/css/index.css" rel="stylesheet" type="text/css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/student/css/normalize.css" />
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/student/css/htmleaf-demo.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/student/css/insert.css">
	<script src="__PUBLIC__/student/js/prefixfree.min.js"></script>

	<!--[if IE]>
		<script src="http://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
	<![endif]--><!-- -->
    <style type="text/css">
    	.layui-upload-button {
			position: relative;
			display: inline-block;
			vertical-align: middle;
			min-width: 60px;
			height: 38px;
			margin-left: 35%;
			line-height: 38px;
			border: 1px solid #DFDFDF;
			border-radius: 2px;
			overflow: hidden;
			background-color: #fff;
			color: #666;
}
    </style>
</head>
<body>
<div class="indexBox">
	<!--头文件-->
	<include file='Public:header' />
	<div class="bodyBox">
    	<div class="bodysidebar_Box">
        	<div class="sidebarIMGBox">
            	<div class="sidebarIMG"> <eq name="person.photo" value="">
					<img class="ui medium circular image" src="__PUBLIC__/student/images/public.png" />
					<else/>
					<img class="ui medium circular image" src="__SITE__{$person.photo}" />
					</eq></div>
            </div>
        	<!--<div class="sidebarNAME">{$person.name}</div>-->
            <div class="sidebarEDITBox">
            	<input type="file" name="photo" id="photo" lay-title="上传头像" class="layui-upload-file">
            </div>
			<div class="" style="margin-left: 20px;">
				<a class="ui teal image label" style="margin: 10px;">
					<i class="User icon middle aligned"></i>
					{$person.name}
					<div class="detail">student</div>
				</a>
				<a class="ui blue image label" style="margin: 10px;">
					<i class="Heterosexual icon middle aligned"></i>
					<if condition="$person['sex'] eq  1">
						男
						<else />
						女
					</if>
					<div class="detail">sex</div>
				</a>
				<a class="ui grey image label" style="margin: 10px;">
					<i class="phone icon middle aligned"></i>
					{$person.phone}
					<div class="detail">phone</div>
				</a>
			</div>

            <!--公告-->
				<div class="ui segment" style="margin-top: 31%;margin-left: 8px;margin-right: 8px;">
					<div class="ui top attached label">
						<div class="ui label">
							<h4 class="ui header"><i class="mail icon large middle aligned"></i> 信息公告</h4>
						</div>
					</div>
						<div class="ui relaxed divided list" style="padding-top: 30px;">
							<volist  name="info" id="vo">
							<div class="item">
								<i class="large Announcement middle aligned icon"></i>
								<div class="content">
									<a class="header" href="{:U('student/FormMgr/gg_detail')}?id={$vo.id}">{$vo.title}<i class="fa-fw"></i></a>
								</div>
								<div class="right floated content">
									<div class="description">{$vo.greatedate|strtotime|date='Y-m-d',###}</div>
								</div>
							</div>
							</volist>
						</div>
				</div>
            <div class="sideNOTICEmore"><a href="{:U('student/FormMgr/gonggao')}">查看更多<i class="icon Angle Double Right"></i></a></div>

        </div>

        <div class="bodyMain_Box">
        <!--begin-->
		  <div class="tab-group">

		    <section id="tab1" title="考试记录" >
           		<include file="TestRecord:recordlist" />
		    </section>

		    <section id="tab2" title="参加考试">
            
		  <div class="mianBodyshow">
			  <include file="TestPaper:paperList" />
          	
          </div>
            
		    </section>
		    <section id="tab3" title="课程信息">
            
		     <div class="mianBodyshow">
             <!--课程信息begin-->
             <div class="testListBox">
             <div class="testLheader">
				 <h4 class="ui horizontal header divider">
					 <i class="Checkmark Box icon"></i>
					 已选课程
				 </h4>
			 </div>
             <!--begin-->
				 <div style="margin-top: 20%;">
					 <div class="testList">
						 <div class="testListLeft">
							 <div class="classNameBorder"><div class="className1">C语言程序设计</div></div>

						 </div>
						 <div class="testListRight">
							 <div class="classInTmp"></div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;任课教师：张星星</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课时间：周三下午7,8节</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课地点：1108</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;课程内容：了解程序基础</div>



						 </div>
					 </div>
					 <!--end-->
					 <!--begin-->
					 <div class="testList">
						 <div class="testListLeft">
							 <div class="classNameBorder"><div class="className2">形势与政策</div></div>

						 </div>
						 <div class="testListRight">
							 <div class="classInTmp"></div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;任课教师：泡菜鱼</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课时间：周二下午7,8节</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课地点：1106</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;课程内容：分析专业发展前景</div>



						 </div>
					 </div>
					 <!--end-->
					 <!--begin-->
					 <div class="testList">
						 <div class="testListLeft">
							 <div class="classNameBorder"><div class="className1">大学英语4</div></div>

						 </div>
						 <div class="testListRight">
							 <div class="classInTmp"></div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;任课教师：吴诗心</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课时间：周一下午7,8节</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;上课地点：1208</div>
							 <div class="testMessage"><font color="#666">●</font>&nbsp;课程内容：英语</div>



						 </div>
					 </div>
					 <!--end-->
				 </div>
                   <!--分页begging-->
                   <div id="page-show3" style="text-align: center;margin-top:20px;margin-bottom: 20px;"></div>
                 </div>
             <!--课程信息end--->
             
             </div>
              
		    </section>
		    <section id="tab4" title="个人信息">
		     <div class="mianBodyshow">
             
             <!--begin-->
             
             <div class="at-container">
			<div class="at-main">
			<include file="indexMgr/personinfo" />
			</div>
			</div>
             <!--end-->
		 </div>
</section>
		    <section id="tab5" title="修改密码">
		       <div class="mianBodyshow">
                   <include file="IndexMgr:password" />
               </div>
		    </section>
             
		 </div>
		
        
        <!--end-->

        
        </div>
        
    </div>

	<include file="Public:foot"/>


</div>



	<script src="__PUBLIC__/student/js/jquery-3.1.1.min.js" type="text/javascript"></script>

	<script type="text/javascript" src="__PUBLIC__/student/js/jquery-tab.js"></script>
	<script src="__PUBLIC__/student/SemanticUI/semantic.min.js"></script>

	<script>
		//这里统一写接口地址
		var canjia_testUrl = "{:U('Student/TestPaper/paperList')}";
		var detailInfoUrl = "{:U('Student/TestPaper/getThePaper_info')}";
		var guoduUrl = "{:U('Student/TestPaper/detailInfo')}";
		var recordlist = "{:U('Student/TestRecord/getRecord')}";	// 考试记录
		var recordDetail = "{:U('Student/TestRecord/detail')}";		// 记录详情
	</script>
	<script src="__PUBLIC__/static/layui/layui.js"></script>
	<!--将每个json接口与js交互分装到单独的js里，注意id或类名-->
	<script src="__PUBLIC__/student/js/canjia_test.js"></script>
	<script src="__PUBLIC__/student/js/record.js"></script>
	<script type="text/javascript">
		$(function(){
			// Calling the plugin
			$('.tab-group').tabify();
			$('.ui.dropdown').dropdown();

		})
	</script>
</body>
<script type="text/javascript">
	// function loginout(){
	//  if(confirm("确认退出吗？")){  
 //        return true;  
 //    }  
 //   		 return false;
	// }
	$('#loginout').click(function(event) {
		layer.confirm('确定退出吗？',{ title:false,icon:3,
		   btn:['确定','取消'] 
		   		},function(){ 
			$.get("{:U('Student/loginMgr/loginout')}",function(){
				 parent.location.href = "{:U('loginMgr/login')}";
			});
		},function(){

		});
	});
	 // href="{:U('Student/loginMgr/loginout')}" 
</script>
<script type="text/javascript">
layui.use(['layer','upload'],function(){
   var layer = layui.layer;
	   layui.upload({
		  url: "{:U('Student/indexMgr/upimage')}"
		  ,before: function(input){
 			$('.layui-upload-file').after( '<input type="hidden" name="userid" value="{$person.id}"/>' );
 			layer.msg('正在上传中!',{time: 1000});
 		 }
		  ,success: function(res){
				if(res.code==1){
					layer.msg('头像上传失败!',{time:1000,icon:3},function(){
						location.reload();
					});
				}else{
					layer.msg('头像上传成功!',{time:1000,icon:6},function(){
						location.reload();
					});
				}
		  }
	});      
	$('#btn').click(function(event) {
	    var id = $("#id").val();
	    var phone = $("#phone").val();
	    var email = $("#email").val();
	    if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){ 
       		layer.msg('手机号码格式不正确!',{icon:5});
       		    return false;
    	}else if(!(/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(email))){
    		layer.msg('邮箱格式不正确!',{icon:5});
    		    return false;
    	}else{
  		 $.ajax({
                 url :"{:U('Student/indexMgr/editPersonInfo')}",
                 type: 'POST',
                 data: {
                 		   studentid:id,
                           phone: phone,
                           email:email,
                         },
                  error: function(request){
                    layer.msg("请求服务器超时", {time: 1000, icon: 5});
                  },
                  success: function(data){
                    if (data.status){
                      layer.msg('保存成功', {time: 1000});
                    }else{
                      layer.msg(data.msg, {time: 1000});
                    }
                  }
           });
  		 }
    return false;
});

	$('#savePsw').click(function(event) {
		var id = $("#id").val();
	    var oldPassword = $("#old").val();
	    var newPassword = $("#new").val();
	    var renewPassword = $("#renew").val();
	    if(oldPassword==""){
	    	layer.msg('原密码不能为空',{icon:5});
	    	return false;
	    }else if((newPassword=="")||(renewPassword=="")){
	    	layer.msg('新密码不能为空',{icon:5});
	    	return false;
	    }else{
	    	if(!(/^[\S]{6,16}$/.test(newPassword))){
	    		layer.msg('密码必须6到16位，且不能出现空格!',{icon:5});
       		    return false;
       		}else{
	    	 $.ajax({
                 url :"{:U('Student/indexMgr/chengepsw')}",
                 type: 'POST',
                 data: {
                 			studentid:id,
                 		   oldPassword:oldPassword,
                           newPassword:newPassword,
                           renewPassword:renewPassword,
                         },
                  error: function(request){
                    layer.msg("请求服务器超时", {time: 1000, icon: 5});
                  },
                  success: function(data){
                    if (data.status){
                      layer.msg('修改成功', {time: 1000},function(){
						location.reload();
					});
                    }else{
                      layer.msg(data.msg, {time: 1000});
                    }
                  }
           });
	    }
	    	  return false;
	    }
});

});
</script>

</html>
